<?php
/* @var $this UsersController */
/* @var $model Users */
/* @var $form CActiveForm */
//global $role_login;
$isnew = $model->isNewRecord;
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'users-form',
	'enableAjaxValidation'=>false,
));
    ?>

	<?php echo $form->errorSummary($model); ?>
    <table border="0" cellpadding="0" cellspacing="0" id="id-form">
        <tr>
            <th valign="top"><?php echo $form->labelEx($model,'user_name'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'user_name',
                array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('user_name')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'user_name', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <? if($model->isNewRecord) : ?>
        <tr>
            <th valign="top"><?php echo $form->labelEx($model,'user_pass'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'user_pass',
                array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('user_pass')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'user_pass', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <?endif;?>
        <tr>
            <th valign="top"><?php echo $form->labelEx($model,'level'); ?></th>
            <td class="idform">
                <?php echo $form->dropDownList($model, 'level', LevelUser::getLevelList(), array(
                'empty' => '(Pilih Role)',
                'style' => 'width:200px'
                )); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('level')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'level', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><?php echo $form->labelEx($model,'id_laskar'); ?></th>
            <td class="idform">
                <?php echo $form->hiddenField($model, 'id_laskar'); ?>
                <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                'name' => 'id_laskar_auto',
                'source' => url('users/getlistjamaah'),
                'value'=> $isnew || $model->id_laskar == null ? '' : u::get_model_by_id('jamaah',$model->id_laskar)->nama,
                'options' => array(
                    'showAnim' => 'fold',
                    'select' => 'js:function(event, ui){ jQuery("#' . CHtml::activeId($model, 'id_laskar') .
                        '").val(ui.item["id"]); }'),
                'htmlOptions' => array('size' => '60'))); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('id_laskar')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'id_laskar', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th>&nbsp;</th>
            <td valign="top">
                <?php echo CHtml::submitButton($model->isNewRecord ? 'Buat' : 'Simpan',array('class'=>'form-submit')); ?>
            </td>
            <td class="idform"></td>
        </tr>
    </table>
<?php $this->endWidget(); ?>

</div><!-- form -->